import router from "../router";
import store from "../store";
import local from "@utils/store/localStorage";

export default function toLogin(push, backUrl) {
  store.dispatch("FedLogOut");
  const { name } = router.currentRoute;
  local.set("login_back_url", backUrl || name);
  if (name !== "Login") {
    push ? router.push({ name: "Login" }) : router.replace({ name: "Login" });
  }
}
